import xlrd


class GetTestData:
    data_add = []
    data_sub = []
    data_mul = []
    data_div = []

    def get_add_data(self, filename, index, begin, end):
        book = xlrd.open_workbook(filename=filename)
        st = book.sheet_by_index(index)
        for i in range(begin, end):
            data = st.row_values(i)[0:3]
            self.data_add.append(data)

    def get_sub_data(self, filename, index, begin, end):
        book = xlrd.open_workbook(filename=filename)
        st = book.sheet_by_index(index)
        for i in range(begin, end):
            data = st.row_values(i)[0:3]
            self.data_sub.append(data)

    def get_mul_data(self, filename, index, begin, end):
        book = xlrd.open_workbook(filename=filename)
        st = book.sheet_by_index(index)
        for i in range(begin, end):
            data = st.row_values(i)[0:3]
            self.data_mul.append(data)

    def get_div_data(self, filename, index, begin, end):
        book = xlrd.open_workbook(filename=filename)
        st = book.sheet_by_index(index)
        for i in range(begin, end):
            data = st.row_values(i)[0:3]
            self.data_div.append(data)

# filename = r"D:\codes\Python\job\pyunittest\test_data.xlsx"
# index = 0
# gtd = GetTestData()
# gtd.get_add_data(filename, index, 1, 10)
# gtd.get_sub_data(filename, index, 10, 19)
# gtd.get_div_data(filename, index, 19, 28)
# gtd.get_mul_data(filename, index, 28, 37)
# print(gtd.data_mul)